package com.atstudy.state;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2022/12/23 14:29
 * @copyright: 博为峰
 */
public class SleepDemo implements Runnable {
    public Object obj = new Object();
    @Override
    public void run() {
        synchronized (obj){
            try {
                Thread.sleep(300);// 不释放锁
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + "," + i);

            }
        }
    }
}
